# Copyright (c) 2008-2009 Mikhail Chernov 
#
# This file is part of dcExplorer.
#
# dcExplorer is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# dcExplorer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with dcExplorer.  If not, see <http://www.gnu.org/licenses/>.

# Scripting class with extensions
package dcExplorer::core::DesignHouse;
use strict;
use utf8;
use core::Prototype;

# Construction methods

sub new 
{
	my $proto = shift;
	my $class = ref($proto) || $proto;
	my $self = {};
	$self->{Prototypes} = ();
	$self->{ById} = {};
	bless ($self, $class);
	return $self;
}

sub set
{
	my $self = shift;
	my $proto = shift;
	push @{$self->{Prototypes}}, $proto;
	$self->{ById}->{$proto->getProp('building_id')} = $proto if defined $proto->getProp('building_id'); 
}

# Scripting interface

sub getPrototypes
{
	my $self = shift;
	return $self->{Prototypes};
}

# Scripting extensions

sub getPrototypeByID
{
	my $self = shift;
	my $id = shift;
	return $self->{ById}->{$id};
}

1;
